
const assetResources = {
  img: {
    xulie1: [
      {
        url: '1.png',
        crossOrigin: true,
      },
      {
        url: '2.png',
        crossOrigin: true,
      },
      {
        url: '3.png',
        crossOrigin: true,
      },
      {
        url: '4.png',
        crossOrigin: true,
      },
    ],
    xulie2: [
      {
        url: '11.png',
        crossOrigin: true,
      },
      {
        url: '22.png',
        crossOrigin: true,
      },
      {
        url: '33.png',
        crossOrigin: true,
      },
      {
        url: '44.png',
        crossOrigin: true,
      },
    ],
    xulie3: [
      {
        url: 'xu01.png',
        crossOrigin: true,
      },
      {
        url: 'xu02.png',
        crossOrigin: true,
      },
      {
        url: 'xu03.png',
        crossOrigin: true,
      },
      {
        url: 'xu04.png',
        crossOrigin: true,
      },
      {
        url: 'xu05.png',
        crossOrigin: true,
      },
      {
        url: 'xu06.png',
        crossOrigin: true,
      },
      {
        url: 'xu07.png',
        crossOrigin: true,
      },
      {
        url: 'xu08.png',
        crossOrigin: true,
      },
      {
        url: 'xu09.png',
        crossOrigin: true,
      },
      {
        url: 'xu10.png',
        crossOrigin: true,
      },
      {
        url: 'xu11.png',
        crossOrigin: true,
      },
      {
        url: 'xu12.png',
        crossOrigin: true,
      },
      {
        url: 'xu13.png',
        crossOrigin: true,
      },
      {
        url: 'xu14.png',
        crossOrigin: true,
      },
      {
        url: 'xu15.png',
        crossOrigin: true,
      },
      {
        url: 'xu16.png',
        crossOrigin: true,
      },
      {
        url: 'xu17.png',
        crossOrigin: true,
      },
      {
        url: 'xu18.png',
        crossOrigin: true,
      },
      {
        url: 'xu19.png',
        crossOrigin: true,
      },
    ],
    otherImgs: [
      {
        url: 'bg.jpg',
        crossOrigin: true,
      },
      {
        url: 'bi.png',
        crossOrigin: true,
      },
      {
        url: 'bottom1.png',
        crossOrigin: true,
      },
      {
        url: 'close.png',
        crossOrigin: true,
      },
      {
        url: 'item.png',
        crossOrigin: true,
      },
      {
        url: 'logo.png',
        crossOrigin: true,
      },
      {
        url: 'packetBg.png',
        crossOrigin: true,
      },
      {
        url: 'qrcode.jpg',
        crossOrigin: true,
      },
      {
        url: 'qian.jpg',
        crossOrigin: true,
      },
      {
        url: 'startPacket.png',
        crossOrigin: true,
      },
      {
        url: '111.png',
        crossOrigin: true,
      },
      {
        url: '222.png',
        crossOrigin: true,
      },
      {
        url: '333.png',
        crossOrigin: true,
      },
      {
        url: '444.png',
        crossOrigin: true,
      },
      {
        url: '555.png',
        crossOrigin: true,
      },
      {
        url: '666.png',
        crossOrigin: true,
      },
      {
        url: '777.png',
        crossOrigin: true,
      },
      {
        url: '888.png',
        crossOrigin: true,
      },
    ],
  }

};

export const addRes = async (type) => {
  let resources = [];

  for (let key in assetResources[type]) {

    let value = assetResources[type][key];

    value.forEach(item => {
      item.url = `${type}/${key}/${item.url}`;
      resources.push(item);
    });

    // console.log('resources===3333', resources);

  }

  await Promise.all(resources.map(item => {
    return new Promise((resolve) => {
      import(`assert/${item.url}`).then(res => {
        item.url = res;
        resolve(item);
      });
    });
  })).then(res => {
    resources = res;
  });

  return resources;
};
